package com.hc;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyTeacher implements InvocationHandler {
    private Teacher teacher;
    private ExtraThing extraThing;
    public ProxyTeacher(Teacher teacher,ExtraThing extraThing) {
        this.teacher = teacher;
        this.extraThing  = extraThing;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        extraThing.manager();
        Object o = method.invoke(teacher, args);
        extraThing.sleep();
        return o;
    }
}
